package com.cskaoyan.order.remote;

import com.cskaoyan.mall.commons.api.CartsForOrder;
import com.cskaoyan.mall.commons.result.ServiceCallResponse;
import com.cskaoyan.mall.dto.ClearCartItemRequest;
import com.cskaoyan.mall.dto.ClearCartItemServiceResponse;
import com.cskaoyan.mall.dto.ProductDetailDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient("duolai-shopping")
public interface ProductApiClient {
    /**
     * 清空指定用户的购物车缓存(用户下完订单之后清理）【没有使用】
     */
    @DeleteMapping(value = "/rpc/cart/items")
    ClearCartItemServiceResponse clearCartItemByUserID(@RequestBody ClearCartItemRequest request);

    /*
        提供给订单服务查询指定商品信息(项目第二阶段才会用到)
     */
    @GetMapping(value = "/rpc/product/detail")
    ServiceCallResponse<ProductDetailDto> getProductDetail(@RequestParam("id") Long id);


    /**
     * @param cartsForOrder
     * @return java.lang.Integer
     * @description 清空指定用户的购物车缓存(用户下完订单之后清理)
     * @author silic xia
     * @since 2022/12/04 22:46
     */
    @PostMapping(value = "/delete/carts")
    Integer deleteCarts(@RequestBody CartsForOrder cartsForOrder);

}

